package com.yuexun.dhdoctor.module.departmentDocumentNew.bean;

import com.yuexun.dhdoctor.module.Contract.bean.People;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wangt on 2017/7/20.
 */

public class AllSelect {

    private static List<People> selectPeoples = new ArrayList<>();
    private static List<DocDataBean> selectDoc = new ArrayList<>();

    public AllSelect() {
    }

    private static AllSelect instance = null;

    public static AllSelect newInstance() {
        if (null == instance) {
            instance = new AllSelect();
        }
        return instance;
    }

//    public void setAllPeople(List<People> addPeople, List<People> delPeople) {
//        if (addPeople != null && addPeople.size() != 0) {
////            Log.e("!!!!!!!!!!!!!!!!增加人员", addPeople.size() + "");
//
//            List<People> removeList = new ArrayList<>();
//            for (int i = 0; i < addPeople.size(); i++) {
//                for (int j = 0; j < selectPeoples.size(); j++) {
//                    if (addPeople.get(i).getJobNum().equals(selectPeoples.get(j).getJobNum())) {
//                        removeList.add(addPeople.get(i));
//                        break;
//                    }
//                }
//            }
//            addPeople.removeAll(removeList);
//
//            selectPeoples.addAll(addPeople);
//        }
//
//        if (delPeople != null && delPeople.size() != 0) {
////            Log.e("!!!!!!!!!!!!!!!!删除人员", delPeople.size() + "");
//
//            List<People> removeList = new ArrayList<>();
//            for (int i = 0; i < selectPeoples.size(); i++) {
//                for (int j = 0; j < delPeople.size(); j++) {
//                    if (selectPeoples.get(i).getJobNum().equals(delPeople.get(j).getJobNum())) {
//                        removeList.add(selectPeoples.get(i));
//                        break;
//                    }
//                }
//            }
//            selectPeoples.removeAll(removeList);
//        }
////        Log.e("!!!!!!!!!!!!!!!!全部选中人员", selectPeoples.size() + "");
//
//    }
//
//    public List<People> getAllpeople() {
//        return selectPeoples;
//    }
//
//    public void clearAllPeople() {
//        selectPeoples.clear();
//    }


    public void setAllDoc(List<DocDataBean> addDoc, List<DocDataBean> delDoc) {
        if (addDoc != null && addDoc.size() != 0) {
//            Log.e("!!!!!!!!!!!!!!!!增加文件", addDoc.size() + "");

            List<DocDataBean> removeList = new ArrayList<>();
            for (int i = 0; i < addDoc.size(); i++) {
                for (int j = 0; j < selectDoc.size(); j++) {
                    if (addDoc.get(i).getDocId().equals(selectDoc.get(j).getDocId())) {
                        removeList.add(addDoc.get(i));
                        break;
                    }
                }
            }
            addDoc.removeAll(removeList);
            selectDoc.addAll(addDoc);
        }

        if (delDoc != null && delDoc.size() != 0) {
//            Log.e("!!!!!!!!!!!!!!!!删除文件", delDoc.size() + "");

            List<DocDataBean> removeList = new ArrayList<>();
            for (int i = 0; i < selectDoc.size(); i++) {
                for (int j = 0; j < delDoc.size(); j++) {
                    if (selectDoc.get(i).getDocId().equals(delDoc.get(j).getDocId())) {
                        removeList.add(selectDoc.get(i));
                        break;
                    }
                }
            }
            selectDoc.removeAll(removeList);
        }
//        Log.e("!!!!!!!!!!!!!!!!全部选中文件", selectDoc.size() + "");
    }

    public List<DocDataBean> getAlldoc() {
        return selectDoc;
    }

    public void clearAllDoc() {
        selectDoc.clear();
    }
}
